/** @type {import('next').NextConfig} */
import type { NextConfig } from "next";
import { config } from "dotenv";
config();
console.log(`backserverurl: ${process.env.BACK_SERVER_URL}`);
const nextConfig: NextConfig = {
  /* config options here */
  //distDir: "build",
  output: "standalone",
  crossOrigin: "anonymous",
  eslint: {
    ignoreDuringBuilds: true,
  },
  async rewrites() {
    return [
      {
        source: "/api/auth/:path*",
        destination: "/api/auth/:path*", // Keep auth routes local
      },
      {
        source: "/api/:path*",
        destination: `${process.env.BACK_SERVER_URL}/:path*`,
      },
    ];
  },
};

export default nextConfig;
